package dao;

import bean.GoodsInfo;

import java.util.ArrayList;
import java.util.List;

public class GoodsInfoDAO {
    public List<GoodsInfo> findAllGoods(){
        List<GoodsInfo> list = new ArrayList<>();
        GoodsInfo gi1 = new GoodsInfo(1,"水杯",18.7,1);
        GoodsInfo gi2 = new GoodsInfo(2,"桌子",108.7,1);
        GoodsInfo gi3 = new GoodsInfo(3,"牛奶",118.7,1);
        GoodsInfo gi4 = new GoodsInfo(4,"面包",28.7,1);
        GoodsInfo gi5 = new GoodsInfo(5,"巧克力",15.7,1);
        GoodsInfo gi6 = new GoodsInfo(6,"棉花糖",8.7,1);
        GoodsInfo gi7 = new GoodsInfo(7,"火腿",58.7,1);
        list.add(gi1);
        list.add(gi2);
        list.add(gi3);
        list.add(gi4);
        list.add(gi5);
        list.add(gi6);
        list.add(gi7);
        return list;
    }
    public GoodsInfo findGoodsById(int goodsId){
        return findAllGoods().get(goodsId-1);
    }
}
